<?php
class input{
    function post($key){
        if(isset($_POST[$key])==false){
            return false;
        }
        $val=$_POST[$key];
        return $val;
    }
    function get($key){
        if(isset($_GET[$key])==false){
            return false;
        }
        $val=$_GET[$key];
        return $val;
    }
}
$input=new input();
include ('shujuku.php');
session_start();
$act=$input->get('act');

if($act!==false){
    $user=$input->post('user');
    $pass=$input->post('password');
    $sql="SELECT * FROM login WHERE user='{$user}' and pass='{$pass}'";
    $mysql_result=$mysql->query($sql);

    if($is=$mysql_result->fetch_array(MYSQLI_ASSOC)){
        $_SESSION['user']=$is['user'];
        header('location:2.php');
    }else{
        echo '登陆失败';
        exit;
    }
}

?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>管理员登录</title>
</head>
<body>
<form action="login.php?act=chk" method="post">
    <input type="text" name="user" />
    <input type="password" name="password">
    <input type="submit" value="登录">
</form>
</body>
</html>